package middleware

import (
	commons "iris_demo/common"

	"github.com/kataras/iris/v12"
)

func SessionLoginAuth(Ctx iris.Context) {
	if auth := commons.SessManager.Start(Ctx).Get("admin_user"); auth == nil {
		Ctx.Redirect("/login")
		return
	}
	Ctx.Next()
}
